<template>
    <div>
      <el-card shadow="always" :body-style="{ padding: '20px' }">
        <el-form  label-width="80px" :inline="true">
            <el-form-item label="一级分类" >                      
                <el-select v-model="categoryStore.c1id" @change="c1Handler" :disabled="scene!=0" >
                    <el-option
                      v-for="(c1,index) in categoryStore.c1List "
                    :key="c1.id"
                    :value="c1.id"
                    :label="c1.name"
                    ></el-option>>
                  </el-select>
            </el-form-item>
            <el-form-item label="二级分类" >
                <el-select v-model="categoryStore.c2id"   @change="c2Handler" :disabled="scene!=0">
                    <el-option
                      v-for="(c2,index) in categoryStore.c2List "
                      :key="c2.id"
                      :label="c2.name"
                      :value="c2.id"
                    />
                  </el-select>
            </el-form-item>
            <el-form-item label="三级分类" >
                <el-select v-model="categoryStore.c3id" :disabled="scene!=0" >
                    <el-option
                      v-for="(c3,index) in categoryStore.c3List "
                      :key="c3.id"
                      :label="c3.name"
                      :value="c3.id"
                    />
                  </el-select>
            </el-form-item>
         
        </el-form>
        
      </el-card>
      
    </div>
</template>

<script setup lang="ts">
    import {ref,onMounted} from 'vue'
    // 引入仓库
    import useCategoryStore from '@/stores/category'
    // 获取仓库
    let categoryStore = useCategoryStore()
onMounted(() => {
    categoryStore.getC1List()
});
// 一级分类下拉菜单的change事件:获取二级分类数据
const c1Handler=()=>{
    categoryStore.getC2List()
}
// 二级分类下拉菜单的change事件:获取三级分类数据
const c2Handler=()=>{
    categoryStore.getC3List()
}

// 接收props
defineProps(['scene'])
</script>

<style scoped>

</style>